using UnityEngine;

namespace LS.Saving
{
    public class SavingUtil
    {
        public static string GetRootPath(SavingPathType pathType)
        {
            switch (pathType)
            { 
                case SavingPathType.TemporaryCache:
                    return Application.temporaryCachePath;

                case SavingPathType.Data:
                    return Application.dataPath;

                case SavingPathType.PersistentData:
                    return Application.persistentDataPath;

                default:
                    return null;
            }
        }

        public static SavingPathType CheckPathType(string path)
        {
            if (path.StartsWith(Application.dataPath))
            {
                return SavingPathType.Data;
            }
            else if (path.StartsWith(Application.persistentDataPath))
            {
                return SavingPathType.PersistentData;
            }
            else if (path.StartsWith(Application.temporaryCachePath))
            {
                return SavingPathType.TemporaryCache;
            }
            else
            {
                return SavingPathType.Undefined;
            }
        }

    }
}
